<?php
// +----------------------------------------------------------------------
// | 文章管理
// +----------------------------------------------------------------------
// | Author: 李乾坤 <261001642@qq.com>
// +----------------------------------------------------------------------
class ArticleAction extends CommonAction {
	public function _filter(&$map){
		if($map['title']!=""){
			$map['title']=array('like',"%".$map['title']."%");
		}
	}
	function add(){	
		$this->display('edit');
	}
    public function _tigger_insert($model)
    {
        $this->saveTag($model->tags, $model->id, 'Article');
        import("ORG.Util.Ping");
        $Ping=new Ping();
        $Ping->Ping($model->id,GTC($model->id,'Article','cid'));
    }
    public function _tigger_update($model)
    {
        $this->_tigger_insert($model);
    }
    function _Before_Add(){
        $Category=D("Category");
        $list=$Category->getCategory('Article');
        $this->assign('CateList',$list);
    }
    function _Before_edit(){
		$this->_Before_Add();
	}
    function _Before_index(){
		$this->_Before_Add();
	}
	
    /*
    public function _before_insert() {
        $this->_before_update();
    }
    public function _before_update() {
        //$_POST['content']=str_replace(array('&lt;','&gt;'), array('&amp;lt;','&amp;gt;'), $_POST['content']);
        //$this->upload('./Public/Uploads/Article/','220,150,true');
    }
    public function delete()
    {
        //删除指定记录
        $model        = M('Article');
        if(!empty($model)) {
            $id         = $_REQUEST["id"];
            if(isset($id)) {
                $condition = array("id"=>array('in',explode(',',$id)));
				$aaa=$model->where($condition)->select();
                if(false !== $model->where($condition)->delete()){
					foreach($aaa as $key=>$val){
						unlink($val['img']);
					}
                    $this->success(L('删除成功'));
                }else {
                    $this->error(L('删除失败'));
                }
            }else {
                $this->error('非法操作');
            }
        }
    }*/
}

?>